package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.domain.MemberPrice;
import com.itheima.mapper.MemberPriceMapper;
import com.itheima.service.IMemberPriceService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品会员价格表 服务实现类
 * </p>
 *
 * @author fukeke
 * @since 2022-11-11
 */
@DubboService
public class MemberPriceServiceImpl extends ServiceImpl<MemberPriceMapper, MemberPrice> implements IMemberPriceService {

    @Autowired
    private MemberPriceMapper pmsMemberPriceMapper;

    /**
     * 商品会员价格设置
     */
    @Override
    public void createMemberPrice(MemberPrice pmsMemberPrice) {
        pmsMemberPriceMapper.insert(pmsMemberPrice);
    }

    /**
     * 更新 商品会员价格设置
     */


    /**
     * 根据productId查询
     */
    @Override
    public List<MemberPrice> selectByProductId(Long toLong) {
        LambdaQueryWrapper<MemberPrice> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MemberPrice::getProductId,toLong);
        return pmsMemberPriceMapper.selectList(queryWrapper);
    }
}
